/*
 * http_c2.h
 *
 *  Created on: Oct 24, 2013
 *      Author: killerg
 */

#ifndef HTTP_C2_H_
#define HTTP_C2_H_

#include <string>
#include <functional>
#include <curl/curl.h>

class http_client2 {
    public:
        typedef std::function<void(int, const std::string&)> client_cb_t;

        bool do_query(const char* url, const char* body, client_cb_t cb = NULL);

        bool init();
        void destroy();
        void update();

        int pending_num() { return still_running; }

    private:
        int still_running;
        CURLM* multi_handle;
};

#endif /* HTTP_C2_H_ */
